package com.afalon.cloud.contracts.competition;

import java.net.URI;

import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.jdo.annotations.IdGeneratorStrategy;
import javax.jdo.annotations.PersistenceCapable;
import javax.jdo.annotations.Persistent;
import javax.jdo.annotations.PrimaryKey;

import com.google.appengine.api.datastore.Key;
import com.google.appengine.api.datastore.KeyFactory;

@PersistenceCapable
@XmlRootElement(name = "ladder")
@XmlAccessorType(XmlAccessType.NONE)
public class Ladder {

	@PrimaryKey
	@Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
    private Key ladderKey;
	
	@XmlElement
	@Persistent
	private String name;
	
	@XmlElement(name="framespermatch")
	@Persistent
	private Integer framesPerMatch;
	
	@XmlElement(name="ladderuri")
	public URI ladderUri;
	
	public Ladder() 
	{
		
	}

	public Key getLadderKey() {
		return ladderKey;
	}
	
	@XmlElement(name="ladderid")
	public String getLadderId() {
		return KeyFactory.keyToString(this.getLadderKey());
	}
		
	public void setName(String value) {
		name = value;
	}

	public String getName() {
		return name;
	}
	
	public void setFramesPerMatch(Integer value) {
		this.framesPerMatch = value;
	}

	public Integer getFramesPerMatch() {
		return this.framesPerMatch;
	}

}
